import { Button } from "antd";
import styles from "./index.module.less";
import {
  arrayAndString,
  doublePoint,
  hashTable,
  matrix,
  slideWindow,
  range,
  stack,
  chainTable,
  binaryTree,
  dp1Dimension,
  huawei,
  interviewProblems,
} from "./problems";
import { TreeNode, generateBinaryTree, generateNodeList } from "./const";
import mathematics from "./problems/mathematics";

const LeetCode = () => {
  const {
    merge,
    removeElement,
    removeDuplicates,
    removeDuplicates2,
    majorityElement,
    rotate,
    maxProfit,
    maxProfit2,
    canJump,
    jump,
    hIndex,
    productExceptSelf,
    longestCommonPrefix,
    canCompleteCircuit,
    candy,
    trap,
    RandomizedSet,
    romanToInt,
    intToRoman,
    convert,
  } = arrayAndString;

  const runFunc1 = () => {
    // merge([1, 2, 3, 0, 0, 0], 3, [2, 5, 6], 3);
    // merge([2, 5, 6, 0, 0, 0], 3, [1, 2, 3], 3);
    // merge([1], 1, [], 0);
    // merge([0], 0, [1], 1);
    // removeElement([3, 2, 2, 3], 3);
    // removeDuplicates([0, 0, 1, 1, 1, 2, 2, 3, 3, 4]);
    // removeDuplicates([1]);
    // removeDuplicates2([1, 1, 1, 2, 2, 3]);
    // majorityElement([3, 2, 3]);
    // majorityElement([2, 2, 1, 1, 1, 2, 2]);
    // rotate([1, 2, 3, 4, 5, 6, 7], 3);
    // rotate([-1, -100, 3, 99], 2);
    // rotate([1, 2], 3);
    // maxProfit([7, 1, 5, 3, 6, 4]);
    // maxProfit2([7, 1, 5, 3, 6, 4]);
    // console.log(canJump([2, 3, 1, 1, 4]));
    // console.log(canJump([3, 0, 8, 2, 0, 0, 1]));
    // console.log(jump([2, 3, 1, 1, 4]));
    // console.log(jump([2, 3, 0, 1, 4]));
    // console.log(hIndex([3, 0, 6, 1, 5]));
    // console.log(productExceptSelf([1, 2, 3, 4]));
    // longestCommonPrefix(["flower", "flow", "flight"]);
    // longestCommonPrefix(["c", "acc", "ccc"]);
    // console.log(canCompleteCircuit([1, 2, 3, 4, 5], [3, 4, 5, 1, 2]));
    // console.log(canCompleteCircuit([4, 5, 2, 6, 5, 3], [3, 2, 7, 3, 2, 9]));
    // candy([1, 2, 87, 87, 87, 2, 1]);
    // console.log(hIndex([3, 0, 6, 1, 5]));
    // let rs = new RandomizedSet();
    // console.log(rs.insert(-1));
    // console.log(rs.remove(-2));
    // console.log(rs.insert(-2));
    // console.log(rs.getRandom());
    // console.log(rs.remove(-1));
    // console.log(rs.insert(-2));
    // console.log(rs.getRandom());
    // romanToInt("III");
    // romanToInt("IV");
    // romanToInt("LVIII");
    // intToRoman(3);
    // intToRoman(4);
    // intToRoman(9);
    // intToRoman(58);
    // intToRoman(1000);
    // convert("PAYPALISHIRING", 3);
  };

  const { isSubsequence, threeSum, maxArea } = doublePoint;

  const runFunc2 = () => {
    // console.log(isSubsequence("aec", "ahbgdc"));
    console.log(maxArea([2, 3, 4, 5, 18, 17, 6]));
    // console.log(threeSum([-1, 0, 1, 2, -1, -4]));
    // console.log(threeSum([-2, 0, 0, 2, 2]));
    // console.log(threeSum([-1, 0, 1, 2, -1, -4, -2, -3, 3, 0, 4]));
  };

  const { minSubArrayLen, lengthOfLongestSubstring } = slideWindow;

  const runFunc3 = () => {
    // minSubArrayLen(11, [1, 2, 3, 4, 5]);
    // lengthOfLongestSubstring("abcabcbb");
    lengthOfLongestSubstring("pwwkew");
  };

  const {
    isValidSudoku,
    spiralOrder,
    rotate: matrixRotate,
    setZeroes,
    gameOfLife,
  } = matrix;

  const runFunc4 = () => {
    // console.log(
    //   isValidSudoku([
    //     ["5", "3", ".", ".", "7", ".", ".", ".", "."],
    //     ["6", ".", ".", "1", "9", "5", ".", ".", "."],
    //     [".", "9", "8", ".", ".", ".", ".", "6", "."],
    //     ["8", ".", ".", ".", "6", ".", ".", ".", "3"],
    //     ["4", ".", ".", "8", ".", "3", ".", ".", "1"],
    //     ["7", ".", ".", ".", "2", ".", ".", ".", "6"],
    //     [".", "6", ".", ".", ".", ".", "2", "8", "."],
    //     [".", ".", ".", "4", "1", "9", ".", ".", "5"],
    //     [".", ".", ".", ".", "8", ".", ".", "7", "9"],
    //   ])
    // );
    // spiralOrder([
    //   [1, 2, 3],
    //   [4, 5, 6],
    //   [7, 8, 9],
    // ]);
    // matrixRotate([
    //   [1, 2, 3],
    //   [4, 5, 6],
    //   [7, 8, 9],
    // ]);
    // setZeroes([
    //   [0, 1, 2, 0],
    //   [3, 4, 5, 2],
    //   [1, 3, 1, 5],
    // ]);
    gameOfLife([
      [0, 1, 0],
      [0, 0, 1],
      [1, 1, 1],
      [0, 0, 0],
    ]);
  };

  const {
    canConstruct,
    isIsomorphic,
    wordPattern,
    isAnagram,
    groupAnagrams,
    twoSum,
    isHappy,
    containsNearbyDuplicate,
    longestConsecutive,
  } = hashTable;

  const runFunc5 = () => {
    // canConstruct("aa", "ab");
    // console.log(isIsomorphic("paper", "title"));
    // console.log(wordPattern("abba", "dog cat cat dog"));
    // console.log(isAnagram("anagram", "nagaram"));
    // console.log(groupAnagrams(["eat", "tea", "tan", "ate", "nat", "bat"]));
    // console.log(twoSum([2, 7, 11, 15], 9));
    // console.log(isHappy(19));
    // console.log(isHappy(2));
    // console.log(containsNearbyDuplicate([1, 2, 3, 1], 3));
    // console.log(containsNearbyDuplicate([1, 2, 3, 1, 2, 3], 2));
    // console.log(longestConsecutive([0, 3, 7, 2, 5, 8, 4, 6, 0, 1]));
    console.log(longestConsecutive([1, 2, 0, 1]));
  };

  const { summaryRanges, merge: rangeMerge, insert, findMinArrowShots } = range;

  const runFunc6 = () => {
    // summaryRanges([0, 1, 2, 4, 5, 7]);
    // rangeMerge([
    //   [2, 3],
    //   [4, 5],
    //   [6, 7],
    //   [8, 9],
    //   [1, 10],
    // ]);
    // insert(
    //   [
    //     [1, 3],
    //     [6, 9],
    //   ],
    //   [2, 5]
    // );
    findMinArrowShots([
      [10, 16],
      [2, 8],
      [1, 6],
      [7, 12],
    ]);
  };

  const { isValid, simplifyPath, evalRPN } = stack;

  const runFunc7 = () => {
    // isValid("()[]{}");
    // isValid("({})");
    // simplifyPath("/a/./b/../../c/");
    evalRPN([
      "10",
      "6",
      "9",
      "3",
      "+",
      "-11",
      "*",
      "/",
      "*",
      "17",
      "+",
      "5",
      "+",
    ]);
  };

  const {
    addTwoNumbers,
    mergeTwoLists,
    reverseBetween,
    removeNthFromEnd,
    deleteDuplicates,
    rotateRight,
    partition,
    copyRandomList,
  } = chainTable;

  const runFunc8 = () => {
    // addTwoNumbers(generateNodeList([2, 4, 3]), generateNodeList([5, 6, 4]));
    // addTwoNumbers(generateNodeList([5, 6]), generateNodeList([5, 4, 9]));
    // mergeTwoLists(generateNodeList([1, 2, 4]), generateNodeList([1, 3, 4]));
    // reverseBetween(generateNodeList([1, 2, 3, 4, 5]), 2, 4);
    // removeNthFromEnd(generateNodeList([1, 2, 3, 4, 5]), 2);
    // removeNthFromEnd(generateNodeList([1, 2]), 2);
    // deleteDuplicates(generateNodeList([1, 2, 3, 3, 4, 4, 5]));
    // rotateRight(generateNodeList([1, 2, 3, 4, 5]), 2);
    // partition(generateNodeList([1, 4, 3, 2, 5, 2]), 3);
  };

  const {
    maxDepth,
    isSameTree,
    invertTree,
    isSymmetric,
    buildTree,
    hasPathSum,
    flatten,
    sumNumbers,
    countNodes,
    lowestCommonAncestor,
  } = binaryTree;

  const runFunc9 = () => {
    // maxDepth(generateBinaryTree([3, 9, 20, null, null, 15, 7]));
    // isSameTree(generateBinaryTree([1, 2, 3]), generateBinaryTree([1, 2, 3]));
    // isSameTree(generateBinaryTree([1, 2]), generateBinaryTree([1, null, 2]));
    // isSameTree(generateBinaryTree([1]), generateBinaryTree([1, null, 2]));
    // invertTree(generateBinaryTree([4, 2, 7, 1, 3, 6, 9]));
    // isSymmetric(generateBinaryTree([1, 2, 2, 3, 4, 4, 3]));
    // buildTree([3, 9, 20, 15, 7], [9, 3, 15, 20, 7]);
    // hasPathSum(
    //   generateBinaryTree([5, 4, 8, 11, null, 13, 4, 7, 2, null, null, null, 1]),
    //   22
    // );
    // hasPathSum(generateBinaryTree([1, 2]), 1);
    // hasPathSum(generateBinaryTree([1]), 1);
    // flatten(generateBinaryTree([1, 2, 5, 3, 4, null, 6]));
    // sumNumbers(generateBinaryTree([4, 9, 0, 5, 1]));
    // countNodes(generateBinaryTree([1, 2, 3, 4, 5, 6]));
    lowestCommonAncestor(
      generateBinaryTree([3, 5, 1, 6, 2, 0, 8, null, null, 7, 4]),
      null,
      null
    );
  };

  const { rob, wordBreak, coinChange, lengthOfLIS } = dp1Dimension;

  const runFunc10 = () => {
    // rob([2, 7, 9, 3, 1]);
    // wordBreak("applepenapple", ["apple", "pen"]);
    // coinChange([1, 2, 5], 11);
    // lengthOfLIS([10, 9, 2, 5, 3, 7, 101, 18]);
    lengthOfLIS([1, 3, 6, 7, 9, 4, 10, 5, 6]);
  };

  const { isPalindrome, plusOne, trailingZeroes, mySqrt } = mathematics;

  const runFunc11 = () => {
    // isPalindrome(101);
    // isPalindrome(10011);
    // plusOne([6, 1, 4, 5, 3, 9, 0, 1, 9, 5, 1, 8, 6, 7, 0, 5, 5, 4, 3]);
    // plusOne([9]);
    // trailingZeroes(30);
    mySqrt(8);
  };

  const {
    longestPalindrome,
    reverseWords,
    oddEvenList,
    isIsomorphic: isIsomorphicHW,
    threeSum: threeSumHW,
    rob: robHW,
    simplifyPath: simplifyPathHW,
    twoSum: twoSumHW,
    maxLength,
    spiralOrder: spiralOrderHW,
    longestCommonSubsequence,
    addStrings,
    clumsy,
    largestValsFromLabels,
    addTwoNumbers: addTwoNumbersHW,
    combinationSum,
    decodeString,
  } = huawei;

  const runFunc12 = () => {
    combinationSum([2], 1);
    // combinationSum([2, 3, 5], 8);
    // combinationSum([2, 3, 6, 7], 7);
    // console.log("input: 3[z]2[2[y]pq4[2[jk]e1[f]]]ef");

    // console.log(
    //   "ans: zzzyypqjkjkefjkjkefjkjkefjkjkefyypqjkjkefjkjkefjkjkefjkjkefef"
    // );

    // decodeString("3[z]2[2[y]pq4[2[jk]e1[f]]]ef");
    // decodeString("abc3[cd]xyz");
    // decodeString("3[a]2[bc]");
    // decodeString("13[a2[c]]");
    // addTwoNumbersHW(generateNodeList([2, 4, 5]), generateNodeList([5, 6, 4]));
    // largestValsFromLabels([5, 4, 3, 2, 1], [1, 1, 2, 2, 3], 3, 1);
    // largestValsFromLabels([5, 4, 3, 2, 1], [1, 3, 3, 3, 2], 3, 2);
    // longestCommonSubsequence("abcde", "ace");
    // clumsy(4);
    // clumsy(8);
    // longestCommonSubsequence("abcde", "ace");
    // addStrings("237", "284");
    // maxLength(["un", "iq", "ue"]);
    // maxLength(["aa", "bb"]);
    // spiralOrderHW([
    //   [1, 2, 3],
    //   [4, 5, 6],
    //   [7, 8, 9],
    // ]);
    // spiralOrderHW([
    //   [1, 2, 3, 4],
    //   [5, 6, 7, 8],
    //   [9, 10, 11, 12],
    // ]);
    // console.log(twoSumHW([2, 7, 11, 15], 9));
    // simplifyPathHW("/a/./b/../../c/");
    // simplifyPathHW("/../");
    // simplifyPathHW("/a//b////c/d//././/..");
    // robHW([2, 3, 2]);
    // robHW([1, 2, 3, 1]);
    // robHW([1, 2, 3]);
    // threeSumHW([-1, 0, 1, 2, -1, -4]);
    // console.log(longestPalindrome("babad"));
    // console.log(longestPalindrome("cbbd"));
    // console.log(longestPalindrome("aacabdkacaa"));
    // reverseWords([
    //   "t",
    //   "h",
    //   "e",
    //   " ",
    //   "s",
    //   "k",
    //   "y",
    //   " ",
    //   "i",
    //   "s",
    //   " ",
    //   "b",
    //   "l",
    //   "u",
    //   "e",
    // ]);
    // oddEvenList(generateNodeList([1, 2, 3, 4, 5]));
    // console.log(isIsomorphicHW("egg", "add"));
    // console.log(isIsomorphicHW("egg", "adb"));
    // console.log(isIsomorphicHW("badc", "baba"));
  };

  const {
    topKFrequent,
    topKFrequentWords,
    lastSubstring,
    reverseList,
    threeSum: threeSumIP,
    LRUCache,
    longestPalindrome: longestPalindromeIP,
    combine,
  } = interviewProblems;

  const runFunc13 = () => {
    combine(4, 3);
    // longestPalindromeIP(
    //   "civilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth"
    // );
    // const lRUCache = new LRUCache(2);
    // lRUCache.put(2, 1); // 缓存是 {1=1}
    // lRUCache.put(1, 1); // 缓存是 {1=1, 2=2}
    // lRUCache.put(2, 3); // 该操作会使得关键字 2 作废，缓存是 {1=1, 3=3}
    // lRUCache.put(4, 1); // 该操作会使得关键字 1 作废，缓存是 {4=4, 3=3}
    // console.log(lRUCache.get(1)); // 返回 -1 (未找到)
    // console.log(lRUCache.get(2)); // 返回 3
    // threeSumIP([-1, 0, 1, 2, -1, -4]);
    // reverseList(generateNodeList([1, 2, 3, 4, 5]));
    // lastSubstring(
    //   "pgtrdjdpscrwjifnrcttyruighgygsuvlhxpckkeahrupvnhlnpulyogsbktcuxnmnbmgadksxdjunqvmzyujynwzevtstjvzkddxjjmbgxfueteeuktvcbvypbdnzostbwxmxdwomguuymexfrrwuvuglgwmmwpkrqrpuzvjujksdwopsqlsrfgyzhymfgejuwhyvoqoxluvsdnmkglypoozrcgnzchpurezauixujddjjawqiaasvhrhfbhsqutgskudpcbqkkrcagrtalnsecxmlbiysgabvjbwpfufiwqdsnwbutashtejpmcypfztbgzuxwfcpkwdzhvfxbtvdvdaufjpqgfgxufhsopvwmgekcjejdlgxtdghmyzvopqkdzpuudyunnafvaeyshluuujkqncyigweelxmvgiaegonqmouaxwaqxhnnvaeuppsritdsymdwonbooswiolhbacpnehyvbhekxqxuvpnaxrfgeyixmurlgszqrotqynvtlbpjhhwdkbneiutmwutiyqegkxsrgldqvziysvihgbplhiumonlzlfzbuavbygmltdnfwjbspfpmzkfryjjpswihwixmbeodfpnmytccdvjnctzkxuqrvgjehodfdhpconhfpnatzzxyqkzjttgnwvxcfwyhlajvuhjonbpkvbbahlbybvvnhrwnnpnagtnnqcewzdzsxjgfoqbipohzsgpmyhqgvvnffjumirbhpbfletvcglthgwdvkgczucreovnfpbugyzuugqodpgsylfwyjucfnxjbghurnrkkuwsjfxeoxyzvltwhzyuechbfwstfovqgxngcwsmqsbzasrfrdvjcgedacvviihnzlijbaotpkvzmfejtfsnljthmzfhsrtieqlfhuatdwhcvsoxyphqsoxaqiqjcbuldswtjsukvcoowyfgmixswlyvkllvdtnerfisymrwgtfleupfxxswdlhvioeilstdlqfckoxpohcgnfannhbeeyzthhmszdphsbhjhxbwmjcknyrcsxgxcgnrvqnrlpqqwilhradmbowdvpusmombllpjikbuokakqzovmtmanaavururxjjxvrdnwabfwchkscmmmyixmjtogqgowbqlymnjcalxkmolmhyalvaftbcsidbmyfxshzdbwsfkvlnunvxzadljqngnnhjmlhfpmwnhvvwaokxxyfslhgggpjnhkyzdqgjdsrtaohqaryixzpyrkjumnphvfpsldrcjhxqjisogvybchagdnoezpvehagcqxarruqncmjifvxxvpbsygkzttmnykeptvbxmjsewbppcciomuyuowzbankzklnnxmnxiztfpfcnddaghyuxgaxmgphspocmpcucxkazeakifbsvnatqcvbeywbxsocgyxiawvmljwmokhbpzvijuckbqrjsdtntlriqgyjznvkkeoszsqsonjlsmxhawqqbdwixvnyemiypirwnoyhvfhbbbkcuyuuepobvrspotbbuvtmpykalufsvizvcelblhokldaymsgqasbobwyxnmcqvzqyldgmimsolloudxkjmiyekaiierxwwflmanqkovzxewrrfipzrclqvedftsuswanhfbcmjigxuxaguasfjypjjrgddnwnrfoazbvezxopumretyqfzqyosmvqjpqnuodylrkucrbhtrljryryewvfbnfwjldgjidvucotlvnsvqyjqwfmqhydttjaapqfdmvcytqpcjkqqrhwfiimbvlkvnvtghrggkjppaduhqpdneeejpqrxbnnenvobcgreldbnzpzrwxvkscywgekcnqnkgngokryvfgthpeggwroimsrwwvfmburaaqrzcmtctfxgrlhzbgixfkdjuerowuvtkmawtsrjzucrniwyzeauuizmfdlufwzqotupmykssvwaqljbiegvbonhqaekpeknpvkzgerjljgridlosexgtjkxnnjcqiahuvwvewsjmxbdhsemaoqsfsgxwghtskfxxxtohbqkascghktyxjeznuhguhvkhkhrgxvfjvktljkvmvkrikybfhjrleqxrwvyevynaprnumwpoazwmbevifrcbcckwmhcqrzgyywxlvxjmckmrfitvkelvoubqmflpmuhlwcjtcokvourxueatywmbsgbtcqzmekogznpbqsahgubnsfzfrvlgqvdsqcjptjkztcwbdciaivtwzavpzxgnbtscpzmffbwzezpijzcxnehhecsdyxabdupyqrfxywcikihubgfwrllhdmampqzewshiumisbuabzuthodmfjczwvwwbxbtadhhqqyqdzrfgzlbtlrtayrflxuehrxmggtbglsijmqiozpaydqxcewzizkdauybxbxhekppdxwnrwuchqotbsvatsxallqoatgdlarcoakioexnkugtpdldgzwnjmrdxtaheygwqmesdtinktgfxwsdibsyqyqdypwpzxucwefnzhfwjcnecbhtpuhcmvnyczwlozxlnsiizeteykfiitgyfqjbsoxvtumabgjhaquojutgxzqniiiisqhixjpcnhvopknagkmbuyqbbhlgaqhrnedonfsinfpywjvncbefkdwiidrmjtfunjhbcyvwnbiffildglmcspbmumhyewizqgfwuvbqawruppyjfkmthxpocpbduzqvecdapdjmiuvzduavdasropcdfmrzdfwkisetbznqubivoqkzvxhiuxowfmrsuevnllosjzzeajuxvvayugkzolddxbhyetzqkrxeyomyjidrculppuxxyuswfzkawloetbximriowohrduwpecmczgurxippfecsdrpybwjhbutwgqqrzckigaqevdazolffbffhpmklobchtddrbaqwfddkizyyhpowbgjiswezvhljhcjmetduxyawxjlzthhuplzwidbcbckqxmnitrniupkrqmzxdyctxgaagizoxgpjcedyuewibyalsvlshpngreerfzrqfloevdearlhcdwmxyjoqozxljgbgnccdefycdrqseaqsybwkvzeeccvkpmvpumlhjhsbaenzpbswpcgnxcvkdwllgwubibjaoiadzndfcodoaczxlugycuhdnkcvxjfzptwutlocwctpdfzfkygjrqxavotfrdlmazcfyjsrffzpnzfmuywpjkgywelrhiejhzeuagmlnefnmpscwcpjlcwbkgqwmohylgekxctqmitgtialbugksfirpemtpeixcypilupvlyppqalshwfeeqsqvjorfmpixdzlbiuxmshemapxjrmxhzkrquumpoiqzdgqldzfqohqyfhjeucjsuvjqtlyopxvgauncwthkcuxrtnsobcpkohuygbgltmgogainwmgebuiesejbwgajeaxhbegysmgfhiqdbpgbzsirzjntnfcvjlrqrstbxgznqzzzlxmkwbpvocrzeyquurrjnoblqeohyqfjhmsakicpazwvbvoouiytydwerlxzffwljqtqcwzytmdbpfloyfoixpqivuatqunngyazxvxdnyxhuahilvwnnmhimgxyvtopgsspwzubozebxefsmvsccyiykpoldfmmrnaywhbkcpgjvhuoclwxkxlbszuasmhynflhldmkkecgxjliseppoqrieqwtjkqidksvxctztcpjgedhsgnarqwyliuwbioarpurqdgubcowdepthbqxrtaxzatwzzoxbyuvinokysodoumpztnvcwtsbicuvtvqxszfdpcfdofzkcyqtojcywcsbijvsgitjbdpmqowvvdtllgdbdotqmkgklpizyltljyfdvmluinspznkutjlhwsfudbwiyrmisaqgjlhcneqnoeqrmsztwdkhjqorbfxpkzkihjpgdggwbajszidcvufnjyqxwwxglawjvneegoxztrcyjqlduczzhgdlesnaeyialxfhtcgwkxjcdsllpqwurenryothdqzdbjmppjyvwzxobkvlrxjytmpklararqdqjjnblxaliqhjvtbzysfkbhroccnlwnslpsvkarenxfezocpdocgamvufzcfjkxijwybwgbfmnnwuuunsoupaxbylxggremxxakntirsqjwkyxkldqokrlwevrvoovoekhesvxmbnycclrdhrzzbovalhtnzdhfuyatdgeyazstiovogkiuuvsjvvofvrfwyoxydkgkvhporcxccrlcecgqakknogwyemwcfmokuflsskyevbdkmmumftzcpdonagopprxcmwwuarqxbxglrnprstubwfjmxpwdsribxcglhhzthhajimjawanewsqmwifzndqwojclkdilkisapeegpeixshskpfdnsbmfjiojelllsvuquupkwvnkgfdwreabvhyswnsnsdofccebjqmawlkqbzcrxqcvargeqvruhgypqcfbltnhswzjbjayqglgsyttnvpxrjbbotzcmoscbykzxoqoqkooycfiviewtmpyzzpicglhsydafzdzresxjeqhahsukeprzooumbltzxhmqktoypcjenuqqlkpwtvyscfcxcodnokzxpcjlimqmeltiipawblteiyaftlvefhrglstuwupkfvjzhrlvejljfahcenhnsqmmcfpnbtwrkukzncabvgyvvfqhsairahkulbejckkoapagatvkhceqswlpzijcwddrooijdcircayscwmordpckluyryrguednmhzleeklgggqujqeobgesjdbpuueenraljjecjxssdosskkbhrnykrfvumazfcjalcttxewlxiwtsojrmeakgzkwympgkdrshbiaamlwwwvacewcjgaruzmcpblpgqdyykxjyybhwwgowlcsliiitgffqdfprvrrf"
    // );
    // lastSubstring(
    //   "jlidhumidloagrlvvxdqscegbeaybfhhyaeilzxdpyvvxixrjytdalknkospradmumysbkizziltzjwsxkteykblcvkfivzmtvnsyrfgvojhyzkouscymixrdfmehiwijntzqptqaxgalygtzvwxnsgcnygbjzeqmbactgmckvssvkentpxcnznrbbnkttnzpvlzfmdvvsozaiycumzlizbfxvyucyagclrifczcvzvrkiqiajindjjyxgxflnjcgckruujsbppxtwgwvrrxgniqplynvboqyvrsxnmbjhgoybqophbxmjhhrznezstujjuucvrrvofktxldxfaioyijoayggmvjmgzjflzxmkwxmxnyizampdcfntdfkxxprgfxjduiwrmgdfuprpljgnbzbedqbzhqsbmohbhlszvdzcgbimfurmkwqaignxbeevevonmdgupugcjxvqglqkwqzrlqequliwmfrvidtpprodcbhgkt"
    // );
    // lastSubstring(
    //   "jlidhumidloagrlvvxdqscegbeaybfhhyaeilzxdpyvvxixrjytdalknkospradmumysbkizziltzjwsxkteykblcvkfivzmtvnsyrfgvojhyzkouscymixrdfmehiwijntzqptqaxgalygtzvwxnsgcnygbjzeqmbactgmckvssvkentpxcnznrbbnkttnzpvlzfmdvvsozaiycumzlizbfxvyucyagclrifczcvzvrkiqiajindjjyxgxflnjcgckruujsbppxtwgwvrrxgniqplynvboqyvrsxnmbjhgoybqophbxmjhhrznezstujjuucvrrvofktxldxfaioyijoayggmvjmgzjflzxmkwxmxnyizampdcfntdfkxxprgfxjduiwrmgdfuprpljgnbzbedqbzhqsbmohbhlszvdzcgbimfurmkwqaignxbeevevonmdgupugcjxvqglqkwqzrlqequliwmfrvidtpprodcbhgkt"
    // );
    // lastSubstring("abab");
    // topKFrequentWords(["love", "i", "leetcode", "i", "love", "coding"], 3);
    // topKFrequentWords(
    //   ["the", "day", "is", "sunny", "the", "the", "the", "sunny", "is", "is"],
    //   4
    // );
    // topKFrequent([1, 1, 1, 2, 2, 3], 2);
    // topKFrequent([1], 1);
  };

  return (
    <div className={styles.contaienr}>
      <Button type="primary" onClick={() => runFunc1()}>
        Run Arrays & Strings
      </Button>
      <Button type="primary" onClick={() => runFunc2()}>
        Run Double Points
      </Button>
      <Button type="primary" onClick={() => runFunc3()}>
        Slide Window
      </Button>
      <Button type="primary" onClick={() => runFunc4()}>
        Matrix
      </Button>
      <Button type="primary" onClick={() => runFunc5()}>
        Hash Table
      </Button>
      <Button type="primary" onClick={() => runFunc6()}>
        Range
      </Button>
      <Button type="primary" onClick={() => runFunc7()}>
        Stack
      </Button>
      <Button type="primary" onClick={() => runFunc8()}>
        Chain Table
      </Button>
      <Button type="primary" onClick={() => runFunc9()}>
        Binary Tree
      </Button>
      <Button type="primary" onClick={() => runFunc10()}>
        DP 1 Dimension
      </Button>
      <Button type="primary" onClick={() => runFunc11()}>
        Mathematics
      </Button>
      <Button type="primary" onClick={() => runFunc12()}>
        HuaWei
      </Button>
      <Button type="primary" onClick={() => runFunc13()}>
        Interview Problems
      </Button>
    </div>
  );
};

export default LeetCode;
